package com.santu.edu.supporter.biz.team.pojo.dto;

import com.santu.edu.supporter.biz.team.pojo.enums.TeamTypeEnum;
import com.santu.edu.supporter.biz.team.pojo.param.UserTeamAddParam;
import com.santu.edu.supporter.biz.team.pojo.po.UserTeamPO;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;

/**
 * @author luoyaoqi
 * @createTime 2024/3/7
 * @description
 */
@Data
@Accessors(chain = true)
public class UserTeamDTO {
    /**
     * 学校id
     */
    private String schoolId;

    /**
     * 团队id
     */
    private String teamId;

    /**
     * 负责人id
     */
    private String userId;

    /**
     * 团队名称
     */
    private String teamName;

    /**
     * 团队类型[0:快递]
     */
    private TeamTypeEnum teamType;

    public static UserTeamDTO create(UserTeamAddParam addParam, String temId) {
        return new UserTeamDTO()
                .setSchoolId(addParam.getSchoolId())
                .setUserId(addParam.getUserId())
                .setTeamId(temId)
                .setTeamName(addParam.getTeamName())
                .setTeamType(TeamTypeEnum.convert(addParam.getTeamType()));

    }

    public static UserTeamDTO createItem(UserTeamPO item) {
        return new UserTeamDTO()
                .setSchoolId(item.getSchoolId())
                .setUserId(item.getUserId())
                .setTeamId(item.getTeamId())
                .setTeamName(item.getTeamName())
                .setTeamType(TeamTypeEnum.convert(item.getTeamType()));
    }
}
